home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume89
/
unix
/
rcs.13
< prev
next >
Wrap
Internet Message Format
|
1989-11-19
|
62KB
Path: xanth!samsung!gem.mps.ohio-state.edu!apple!sun-barr!newstop!sun!swap!page
From: page%swap@Sun.COM (Bob Page)
Newsgroups: comp.sources.amiga
Subject: v89i228: rcs - revision control system, Part13/14
Message-ID: <128104@sun.Eng.Sun.COM>
Date: 19 Nov 89 09:26:11 GMT
Sender: news@sun.Eng.Sun.COM
Lines: 2160
Approved: page@sun.com
Submitted-by: rsbx@cbmvax.commodore.com (Raymond S. Brand)
Posting-number: Volume 89, Issue 228
Archive-name: unix/rcs.13
# This is a shell archive.
# Remove anything above and including the cut line.
# Then run the rest of the file through 'sh'.
# Unpacked files will be owned by you and have default permissions.
#----cut here-----cut here-----cut here-----cut here----#
#!/bin/sh
# shar: SHell ARchive
# Run the following text through 'sh' to create:
# rcs/rcs.rcsfiles/merge.c,v
# rcs/rcs.rcsfiles/makefile,v
# rcs/rcs.rcsfiles/co.c,v
# rcs/rcs.rcsfiles/curdir.c,v
# This is archive 13 of a 14-part kit.
# This archive created: Sun Nov 19 01:12:13 1989
if `test ! -d rcs`
then
mkdir rcs
echo "mkdir rcs"
fi
if `test ! -d rcs/rcs.rcsfiles`
then
mkdir rcs/rcs.rcsfiles
echo "mkdir rcs/rcs.rcsfiles"
fi
echo "extracting rcs/rcs.rcsfiles/merge.c,v"
sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/merge.c,v
Xhead 1.2;
Xbranch 1;
Xaccess ;
Xsymbols amiga_rcs:1;
Xlocks ; strict;
Xcomment @ * @;
X
X
X1.2
Xdate 89.11.10.15.24.53; author rsbx; state Exp;
Xbranches ;
Xnext 1.1;
X
X1.1
Xdate 89.11.03.20.47.54; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X
Xdesc
X@C implementation of the "merge.sh" script in the 4.? RCS source
Xdistribution.
X@
X
X
X1.2
Xlog
X@Sync'd BUFFSIZE with size of fread().
X@
Xtext
X@/*
X * merge.c
X *
X * Rick Schaeffer (ricks@@iscuva.iscs.com)
X * Raymond S. Brand (rsbx@@cbmvax.commodore.com)
X *
X * This is a 'c' implementation of the 'merge.sh' scriptin the
X * 4.? RCS source distribution
X *
X */
X
X#ifndef lint
X static char rcsid[]=
X "$Header: /u/softeng/rsbx/rcs/amiga/RCS/merge.c,v 1.1 89/11/03 20:47:54 rsbx Exp Locker: rsbx $";
X#endif
X/*
X * $Log: merge.c,v $
X * Revision 1.1 89/11/03 20:47:54 rsbx
X * Initial revision
X *
X */
X
X#include <stdio.h>
X
Xextern FILE *popenl(char *, ... );
X
X#define BUFFSIZE 256
X
Xstatic char buff[BUFFSIZE];
X
Xvoid main(int argc, char **argv)
X {
X FILE *fptr, *pipefp;
X char *pswitch;
X int overlaps, count;
X char *cmd = *argv;
X
X if (argc < 3)
X {
X printf("Usage: %s [-p] file1 file2 file3\n", cmd);
X exit(1);
X }
X
X if (!strcmp(argv[1], "-p"))
X {
X pswitch = "1,$p\n";
X argv++;
X }
X else
X {
X pswitch = "w\n";
X }
X
X if (!(fptr = popenl(DIFF3, "-E", argv[1], argv[2], argv[3], NULL, "r")))
X {
X fprintf(stderr, "%s: unable to open %s pipe\n", cmd, DIFF3);
X exit(1);
X }
X
X if (!(pipefp = popenl(ED, "-", argv[1], NULL, "w")))
X {
X pclose(fptr);
X fprintf(stderr, "%s: unable to open %s pipe\n", cmd, ED);
X exit(1);
X }
X
X while (count = fread(buff, 1, BUFFSIZE, fptr))
X {
X fwrite(buff, 1, count, pipefp);
X }
X
X fputs(pswitch, pipefp);
X pclose(pipefp);
X
X if (overlaps = pclose(fptr))
X {
X pswitch = "";
X if (overlaps != 1)
X {
X pswitch = "s";
X }
X fprintf(stderr, "Warning: %d overlap%s during merge\n", overlaps, pswitch);
X }
X }
X@
X
X
X1.1
Xlog
X@Initial revision
X@
Xtext
X@d14 1
Xa14 1
X "$Header$";
Xd17 4
Xa20 1
X * $Log$
Xa26 3
X#ifdef DEBUG
X#define BUFFSIZE 32
X#else
Xa27 1
X#endif
Xd67 1
Xa67 1
X while (count = fread(buff, 1, 256, fptr))
X@
SHAR_EOF
echo "extracting rcs/rcs.rcsfiles/makefile,v"
sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/makefile,v
Xhead 1.13;
Xbranch 1.13.2;
Xaccess ;
Xsymbols amiga_rcs:1.13.2 cbmvax_source:1.13.1 uunet_june89_dist:1.13;
Xlocks rsbx:1.13.2.4; strict;
Xcomment @# @;
X
X
X1.13
Xdate 89.05.02.14.53.40; author narten; state Exp;
Xbranches 1.13.1.1 1.13.2.1;
Xnext ;
X
X1.13.1.1
Xdate 89.08.11.01.41.03; author rsbx; state Exp;
Xbranches ;
Xnext 1.13.1.2;
X
X1.13.1.2
Xdate 89.08.11.02.15.34; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X1.13.2.1
Xdate 89.10.13.19.16.09; author rsbx; state Exp;
Xbranches ;
Xnext 1.13.2.2;
X
X1.13.2.2
Xdate 89.10.15.15.38.02; author rsbx; state Exp;
Xbranches ;
Xnext 1.13.2.3;
X
X1.13.2.3
Xdate 89.11.03.20.53.51; author rsbx; state Exp;
Xbranches ;
Xnext 1.13.2.4;
X
X1.13.2.4
Xdate 89.11.05.18.05.11; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X
Xdesc
X@Makefile for RCS distribution.
X@
X
X
X1.13
Xlog
X@checked in with -k by rsbx at 89.08.10.16.00.19.
X@
Xtext
X@#$Header: /usr/src/local/bin/rcs/src/RCS/Makefile,v 1.13 89/05/02 14:53:40 narten Exp $
X# Copyright (C) 1982, 1988, 1989 Walter Tichy
X# All rights reserved.
X#
X# Redistribution and use in source and binary forms are permitted
X# provided that the above copyright notice and this paragraph are
X# duplicated in all such forms and that any documentation,
X# advertising materials, and other materials related to such
X# distribution and use acknowledge that the software was developed
X# by Walter Tichy.
X# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X#
X# Report all problems and direct all questions to:
X# rcs-bugs@@cs.purdue.edu
X#
X#
X#
X#
X#
X#
X#
X#
X# INSTRUCTIONS
X# ============
X# 0. If you are porting to different hardware,
X# check the instructions in rcsbase.h
X#
X# Note: instructions 1-5 are normally taken care of by the calling make,
X# which passes in DIFF, DIFF3, RCSDIR, OLDDIR, OS, and LOCKING.
X#
X# 1. Early version of diff did not support options needed by RCS.
X# Newer versions of diff, support them and diff is no longer distributed with
X# RCS. The following definitions apply only if you have both old versions
X# and new versions of diff, and you want RCS to use the new versions.
X# The default should be :
X#
X
XDIFF = /bin/diff
XDIFF3 = /usr/lib/diff3
X
X# 2. Figure out where to put the RCS commands; define RCSDIR accordingly.
X
XRCSDIR = /usr/local/bin
X
X
X# 3. Figure out where to put your old RCS commands; define OLDDIR
X# accordingly. This is not needed if you don't have an old release of RCS.
XOLDDIR = /usr/old/bin
X
X# 4. Set the operating system variable OS. If you run on 4.1 BSD, do not
X# define OS:
X# OS =
X# If you run on USG Unix or UN*X, use:
X# OS = -DUSG
X# If you run on Version 6 Unix, use:
X# OS = -DV6
X# If you run on 4.2 or 4.3 BSD, use:
X# OS = -DV4_2BSD
XOS = -DV4_2BSD
X
X# Also, set SIGNAL_TYPE to be what your signal() handlers yield.
X# Old-fashioned signal handlers yield 'int'; the newer ones 'void'.
X
XSIGNAL_TYPE = int
X
X# 5. Decide whether you want strict locking as the default or not.
X# If you want strict locking, use:
X# LOCKING = 1
X# otherwise:
X# LOCKING = 0
XLOCKING = 1
X
X# 6. Decide what loader flags you need, and define LDFLAGS accordingly.
X# On the Vax you need none, on PDP-11s with split i/d you need -i.
X#LDFLAGS = -i
XLDFLAGS =
X
X# 7. RCS can maintain a log of the use of the co and ci commands. If you
X# want the logging, you must
X# a) define SNOOP (that's where the process that writes the log goes),
X# b) define SNOOPFILE (that's the file where SNOOP writes the log;
X# it must be owned by the same user that owns SNOOP),
X# c) include SNOOP and SNOOPFILE in the CFLAGS macro.
X# If you don't want the logging of command usage, omit the SNOOP and
X# SNOOPFILE definitions from CFLAGS.
X# The two variants of the CFLAG macros are given below.
XSNOOPFILE = /usr/log/rcslog/log
XSNOOP = /usr/local/bin/snoop
X
XDEFINES= -DCOMPAT2 $(OS) -DSIGNAL_TYPE=$(SIGNAL_TYPE) -DSTRICT_LOCKING=$(LOCKING) -DDIFF='"$(DIFF)"' -DCO='"${RCSDIR}/co"' -DMERGE='"${RCSDIR}/merge"'
XCFLAGS = -O $(DEFINES)
XLINTFLAGS = -c -u
XLINT = lint $(LINTFLAGS) -Dlint $(DEFINES)
X
X# 8. If you don't have release 2 RCS files around (e.g., if you don't
X# have release 2 of RCS), remove the word -DCOMPAT2 from whatever
X# variant of CFLAGS you selected. -DCOMPAT2 assures that release 2
X# RCS files can still be read. (After all release 2 RCS files have
X# been updated with release 3 or 4 ci or rcs, you can remake RCS without
X# -DCOMPAT2.) Also, make sure that the co commands at the end of this
X# file are commented out; otherwise, Make will complain.
X#
X# 9. Now you are ready. Try to make 'depend' and 'all'. If all went well, make
X# 'install' if you want no logging of command usage, 'installog' otherwise.
X#
X# 10. IMPORTANT! When you have RCS installed, rename old
X# release 2 RCS files as follows (if you have any):
X# If the working file was "f.c" and the RCS file "f.c.v", rename the
X# RCS file to "f.c,v". If the working file was "f.c" and the RCS file
X# "f.v", rename the RCS file "f.c,v". Thus, suffixes are no longer
X# dropped and RCS files end in ",v" rather than ".v".
X#
X# 11. If you want to maintain RCS with itself, be sure you preserve the
X# original revision numbers, dates, etc. This is done by checking the
X# files in with the -k option. When done, remove the comments from the
X# co-rules at the end of this file.
X#
XBCOMMANDS = ci ident rcs rcsdiff rcsmerge rlog co
X# binary comands
X
XRCSCOMMANDS = merge $(BCOMMANDS)
X# all commands
X
XBOBJECTS = ci.o co.o ident.o rcs.o rcsdiff.o rcsedit.o\
X rcsfcmp.o rcsfnms.o rcsgen.o rcskeep.o rcskeys.o rcslex.o rcsmerge.o\
X rcsrev.o rcssyn.o rcsutil.o rlog.o snoop.o\
X rcssynTST.o rcsrevTST.o rcsfnmsTST.o rcsfcmpTST.o rcskeepTST.o
X
Xall: $(RCSCOMMANDS)
X
XINSTALL = install
X
X$(BOBJECTS): rcsbase.h
X
Xpartime.o maketime.o co.o ci.o rcs.o rlog.o rcsutil.o: time.h
X
Xinstall: all
X# Save the old commands if you have any.
X# -cd ${RCSDIR}; mv $(RCSCOMMANDS) ${RCSDIR}$(OLDDIR)
X ${INSTALL} -m 775 -o root -s ci ${RCSDIR}
X ${INSTALL} -m 775 -o root -s ident ${RCSDIR}
X ${INSTALL} -m 775 -o root -s rcs ${RCSDIR}
X ${INSTALL} -m 775 -o root -s rcsdiff ${RCSDIR}
X ${INSTALL} -m 775 -o root -s rcsmerge ${RCSDIR}
X ${INSTALL} -m 775 -o root -s rlog ${RCSDIR}
X ${INSTALL} -m 775 -o root -s co ${RCSDIR}
X ${INSTALL} -m 775 -o root -c merge ${RCSDIR}
X# ${INSTALL} -m 775 -o root -c rcsclean ${RCSDIR}
X# ${INSTALL} -m 775 -o root -c rcsfreeze.sh ${RCSDIR}/rcsfreeze
X
Xinstallog: installsnoop install
X
Xinstallsnoop: snoop
X install -s snoop ${RCSDIR}$(SNOOP)
X chmod u+s ${RCSDIR}$(SNOOP)
X touch ${RCSDIR}$(SNOOPFILE)
X chmod 644 ${RCSDIR}$(SNOOPFILE)
X# CAUTION: You may have to do a chown of SNOOP and SNOOPFILE (if not owned by root).
Xlint: ci.lint co.lint ident.lint rlog.lint rcs.lint rcsdiff.lint rcsmerge.lint snoop.lint
X
Xclean:
X -rm -f *.o; rm -f $(RCSCOMMANDS) snoop
X
XCIFILES = ci.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o rcskeep.o rcsfcmp.o
X
XCISRC = ci.c rcslex.c rcssyn.c rcsgen.c rcsedit.c rcskeys.c rcsrev.c rcsutil.c rcsfnms.c partime.c maketime.c rcskeep.c rcsfcmp.c
X
Xci.lint:
X $(LINT) $(CISRC)
X
Xci: $(CIFILES)
X ${CC} $(LDFLAGS) -o ci $(CIFILES)
X
XCOFILES = co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o
X
XCOSRC = co.c rcslex.c rcssyn.c rcsgen.c rcsedit.c rcskeys.c rcsrev.c rcsutil.c rcsfnms.c partime.c maketime.c
Xco.lint:
X $(LINT) $(COSRC)
Xco: $(COFILES)
X ${CC} $(LDFLAGS) -o co $(COFILES)
X
Xident: ident.o rcskeys.o
X ${CC} $(LDFLAGS) -o ident ident.o rcskeys.o
X
Xident.lint:
X $(LINT) ident.c rcskeys.c
X
Xmerge: merge.sh
X sed -e '/^#/d' \
X -e 's:DIFF=.*$$:DIFF=$(DIFF):' \
X -e 's:DIFF3=.*$$:DIFF3=$(DIFF3):' \
X merge.sh > merge
X# This takes out the comment lines and substitutes in DIFF and DIFF3.
X# (Comments are not permitted in some older shells.)
X chmod 755 merge
X
XRLOG = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o maketime.o rcsfnms.o
XRLOGSRC = rlog.c rcslex.c rcssyn.c rcsrev.c rcsutil.c partime.c maketime.c rcsfnms.c
Xrlog: $(RLOG)
X ${CC} $(LDFLAGS) -o rlog $(RLOG)
X
Xrlog.lint:
X $(LINT) $(RLOGSRC)
X
XRCS = rcs.o rcslex.o rcssyn.o rcsrev.o rcsutil.o rcsgen.o rcsedit.o rcskeys.o rcsfnms.o
X
XRCSSRC = rcs.c rcslex.c rcssyn.c rcsrev.c rcsutil.c rcsgen.c rcsedit.c rcskeys.c rcsfnms.c
Xrcs: $(RCS)
X ${CC} $(LDFLAGS) -o rcs $(RCS)
X
Xrcs.lint:
X $(LINT) $(RCSSRC)
X
Xrcsclean: rcsclean.sh
X sed -e '/^#/d' rcsclean.sh > rcsclean
X# This takes out the comments (not permitted in older shells).
X chmod 755 rcsclean
X
XRCSDIFF = rcsdiff.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
XRCSDIFFSRC = rcsdiff.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X
Xrcsdiff: $(RCSDIFF)
X ${CC} ${LDFLAGS} -o rcsdiff $(RCSDIFF)
X
Xrcsdiff.lint:
X $(LINT) $(RCSDIFFSRC)
XRCSMERGE = rcsmerge.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
XRCSMERGESRC = rcsmerge.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
Xrcsmerge: $(RCSMERGE)
X ${CC} ${LDFLAGS} -o rcsmerge $(RCSMERGE)
Xrcsmerge.lint:
X $(LINT) $(RCSMERGESRC)
X
Xsnoop: snoop.o
X ${CC} ${LDFLAGS} -o snoop snoop.o
Xsnoop.lint:
X $(LINT) snoop.c
X
XSOURCE= ci.c co.c curdir.c ident.c maketime.c partime.c rcs.c \
X rcsclean.c rcsdiff.c rcsedit.c rcsfcmp.c rcsfnms.c rcsgen.c \
X rcskeep.c rcskeys.c rcslex.c rcsmerge.c rcsrev.c rcssyn.c rcsutil.c \
X rlog.c snoop.c
X
XHFILES= rcsbase.h time.h
X
Xdepend: ${SOURCE} ${HFILES}
X (sed '/^# DO NOT DELETE THIS LINE/q' Makefile && \
X cc -M ${CFLAGS} ${SOURCE} | sed 's/\.\///; /\//d' \
X ) >Makefile.new
X cp Makefile Makefile.bak
X cp Makefile.new Makefile
X rm -f Makefile.new
X
X
X# DO NOT DELETE THIS LINE -
Xci.o: ci.c
Xci.o: rcsbase.h
Xci.o: time.h
Xco.o: co.c
Xco.o: rcsbase.h
Xco.o: time.h
Xcurdir.o: curdir.c
Xcurdir.o: rcsbase.h
Xident.o: ident.c
Xident.o: rcsbase.h
Xmaketime.o: maketime.c
Xmaketime.o: rcsbase.h
Xmaketime.o: time.h
Xpartime.o: partime.c
Xpartime.o: time.h
Xrcs.o: rcs.c
Xrcs.o: rcsbase.h
Xrcsclean.o: rcsclean.c
Xrcsclean.o: rcsbase.h
Xrcsdiff.o: rcsdiff.c
Xrcsdiff.o: rcsbase.h
Xrcsedit.o: rcsedit.c
Xrcsedit.o: rcsbase.h
Xrcsfcmp.o: rcsfcmp.c
Xrcsfcmp.o: rcsbase.h
Xrcsfnms.o: rcsfnms.c
Xrcsfnms.o: rcsbase.h
Xrcsgen.o: rcsgen.c
Xrcsgen.o: rcsbase.h
Xrcskeep.o: rcskeep.c
Xrcskeep.o: rcsbase.h
Xrcskeys.o: rcskeys.c
Xrcskeys.o: rcsbase.h
Xrcslex.o: rcslex.c
Xrcslex.o: rcsbase.h
Xrcsmerge.o: rcsmerge.c
Xrcsmerge.o: rcsbase.h
Xrcsrev.o: rcsrev.c
Xrcsrev.o: rcsbase.h
Xrcssyn.o: rcssyn.c
Xrcssyn.o: rcsbase.h
Xrcsutil.o: rcsutil.c
Xrcsutil.o: rcsbase.h
Xrlog.o: rlog.c
Xrlog.o: time.h
Xrlog.o: rcsbase.h
Xsnoop.o: snoop.c
Xsnoop.o: rcsbase.h
X@
X
X
X1.13.2.1
Xlog
X@Start of Amiga RCS port branch.
X@
Xtext
X@d1 1
Xa1 1
X#$Header: /u/softeng/rsbx/rcs/amiga/RCS.cbmvax/Makefile,v 1.13.1.2 89/08/11 02:15:34 rsbx Exp Locker: rsbx $
Xd40 2
Xa41 2
XDIFF = /usr/local/bin/diff
XDIFF3 = /usr/local/bin/diff3
Xd45 1
Xa45 1
XRCSDIR = /u/softeng/rsbx/.bin
Xd50 1
Xa50 1
X#OLDDIR = /usr/old/bin
Xd66 1
Xa66 1
XSIGNAL_TYPE = void
Xd89 2
Xa90 2
X#SNOOPFILE = /usr/log/rcslog/log
X#SNOOP = /usr/local/bin/snoop
Xd92 1
Xa92 1
XDEFINES= $(OS) -DSIGNAL_TYPE=$(SIGNAL_TYPE) -DSTRICT_LOCKING=$(LOCKING) -DDIFF='"$(DIFF)"' -DCO='"${RCSDIR}/co"' -DMERGE='"${RCSDIR}/merge"'
Xd258 48
Xa305 22
Xci.c:
Xco.c:
Xcurdir.c:
Xident.c:
Xmaketime.c:
Xpartime.c:
Xrcs.c:
Xrcsclean.c:
Xrcsdiff.c:
Xrcsedit.c:
Xrcsfcmp.c:
Xrcsfnms.c:
Xrcsgen.c:
Xrcskeep.c:
Xrcskeys.c:
Xrcslex.c:
Xrcsmerge.c:
Xrcsrev.c:
Xrcssyn.c:
Xrcsutil.c:
Xrlog.c:
Xsnoop.c:
X@
X
X
X1.13.2.2
Xlog
X@Restructured for use with LMK.
X@
Xtext
X@d1 1
Xa1 1
X#$Header: /u/softeng/rsbx/rcs/amiga/RCS/Makefile,v 1.13.2.1 89/10/13 19:16:09 rsbx Exp Locker: rsbx $
Xa18 17
X.SILENT:
X
XCC1=lc1
XCC2=go
XCC3=lc2
XC1FLAGS = -j85i -d1
XC2FLAGS =
XC3FLAGS =
X
X.c.o:
X $(CC1) -. $(C1FLAGS) $(CFLAGS) -oQUAD: $*
X $(CC2) -. $(C2FLAGS) QUAD:$*.q
X $(CC3) -. $(C3FLAGS) -o$*.o QUAD:$*.q
X
X#.c.o:
X# $(CC1) -. $(C1FLAGS) $(CFLAGS) -oQUAD: $*
X# $(CC3) -. $(C3FLAGS) -o$*.o QUAD:$*.q
Xd24 1
Xd40 2
Xa41 2
XDIFF = RCS:diff
XDIFF3 = RCS:diff3
Xd45 1
Xa45 1
XRCSDIR = RCS:
Xd61 1
Xa61 2
XOS = -dAMIGA
XARGS = -dSTDARGS
Xd78 1
Xa78 2
XLDFLAGS = quiet batch
XLDLIBS = LIB:lc.lib LIB:amiga.lib
Xd92 4
Xa95 2
XDEFINES = $(OS) $(ARGS) -dSIGNAL_TYPE=$(SIGNAL_TYPE) -dSTRICT_LOCKING=$(LOCKING) -dDIFF="$(DIFF)" -dCO="${RCSDIR}co" -dMERGE="${RCSDIR}merge"
XCFLAGS = $(DEFINES)
Xd123 1
Xa123 1
XRCSCOMMANDS = $(BCOMMANDS)
Xd126 4
Xd133 1
Xd135 28
Xd164 1
Xa164 3
X -rm -f *.o
X -rm -f $(RCSCOMMANDS) snoop
X -rm -f *.tmp
Xd166 1
Xd168 1
Xa168 6
XCIOBJ = ci.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o rcskeep.o rcsfcmp.o amiga.o
XCISRC = ci.c rcslex.c rcssyn.c rcsgen.c rcsedit.c rcskeys.c rcsrev.c rcsutil.c rcsfnms.c partime.c maketime.c rcskeep.c rcsfcmp.c amiga.c
Xci: $(CIOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(CIOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd170 5
Xd176 1
Xa176 6
XCOOBJ = co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o amiga.o
XCOSRC = co.c rcslex.c rcssyn.c rcsgen.c rcsedit.c rcskeys.c rcsrev.c rcsutil.c rcsfnms.c partime.c maketime.c amiga.c
Xco: $(COOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(COOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd178 5
Xa182 6
XIDENTOBJ = ident.o rcskeys.o
XIDENTSRC = ident.c rcskeys.c
Xident: $(IDENTOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(IDENTOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd184 2
Xd187 2
Xa188 6
XRLOGOBJ = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o maketime.o rcsfnms.o amiga.o
XRLOGSRC = rlog.c rcslex.c rcssyn.c rcsrev.c rcsutil.c partime.c maketime.c rcsfnms.c amiga.c
Xrlog: $(RLOGOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(RLOGOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd190 8
Xd199 4
Xa202 6
XRCSOBJ = rcs.o rcslex.o rcssyn.o rcsrev.o rcsutil.o rcsgen.o rcsedit.o rcskeys.o rcsfnms.o amiga.o
XRCSSRC = rcs.c rcslex.c rcssyn.c rcsrev.c rcsutil.c rcsgen.c rcsedit.c rcskeys.c rcsfnms.c amiga.c
Xrcs: $(RCSOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(RCSOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd204 2
Xd207 1
Xa207 6
XRCSDIFFOBJ = rcsdiff.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o amiga.o
XRCSDIFFSRC = rcsdiff.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c amiga.c
Xrcsdiff: $(RCSDIFFOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(RCSDIFFOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd209 3
Xd213 22
Xa234 6
XRCSMERGEOBJ = rcsmerge.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o amiga.o
XRCSMERGESRC = rcsmerge.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c amiga.c
Xrcsmerge: $(RCSMERGEOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(RCSMERGEOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xd236 4
Xa239 6
XSNOOPOBJ = snoop.o
XSNOOPSRC = snoop.c
Xsnoop: $(SNOOPOBJ)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:c.o $(SNOOPOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
Xa240 1
X
Xd244 1
Xa244 1
X rlog.c snoop.c amiga.c
Xd246 1
Xa246 1
XHFILES= rcsbase.h time.h stat.h
Xd250 1
Xa250 1
X cc -Em ${CFLAGS} ${SOURCE} | sed 's/\.\///; /\//d' \
Xd258 22
Xa279 55
Xci.o: ci.c
Xci.o: rcsbase.h
Xci.o: stat.h
Xci.o: time.h
Xco.o: co.c
Xco.o: rcsbase.h
Xco.o: stat.h
Xco.o: time.h
Xcurdir.o: curdir.c
Xcurdir.o: rcsbase.h
Xident.o: ident.c
Xident.o: rcsbase.h
Xmaketime.o: maketime.c
Xmaketime.o: rcsbase.h
Xmaketime.o: time.h
Xpartime.o: partime.c
Xpartime.o: time.h
Xrcs.o: rcs.c
Xrcs.o: stat.h
Xrcs.o: rcsbase.h
Xrcsclean.o: rcsclean.c
Xrcsclean.o: rcsbase.h
Xrcsdiff.o: rcsdiff.c
Xrcsdiff.o: rcsbase.h
Xrcsedit.o: rcsedit.c
Xrcsedit.o: rcsbase.h
Xrcsfcmp.o: rcsfcmp.c
Xrcsfcmp.o: rcsbase.h
Xrcsfnms.o: rcsfnms.c
Xrcsfnms.o: stat.h
Xrcsfnms.o: rcsbase.h
Xrcsgen.o: rcsgen.c
Xrcsgen.o: rcsbase.h
Xrcskeep.o: rcskeep.c
Xrcskeep.o: rcsbase.h
Xrcskeys.o: rcskeys.c
Xrcskeys.o: rcsbase.h
Xrcslex.o: rcslex.c
Xrcslex.o: rcsbase.h
Xrcsmerge.o: rcsmerge.c
Xrcsmerge.o: rcsbase.h
Xrcsrev.o: rcsrev.c
Xrcsrev.o: rcsbase.h
Xrcssyn.o: rcssyn.c
Xrcssyn.o: rcsbase.h
Xrcsutil.o: rcsutil.c
Xrcsutil.o: stat.h
Xrcsutil.o: rcsbase.h
Xrlog.o: rlog.c
Xrlog.o: time.h
Xrlog.o: rcsbase.h
Xsnoop.o: snoop.c
Xsnoop.o: rcsbase.h
Xamiga.o: amiga.c
Xamiga.o: stat.h
X@
X
X
X1.13.2.3
Xlog
X@Many changes. Added merge to list of commands.
X@
Xtext
X@d1 1
Xa1 1
X#$Header: /u/softeng/rsbx/rcs/amiga/RCS/Makefile,v 1.13.2.2 89/10/15 15:38:02 rsbx Exp $
Xd24 1
Xa24 1
XC1FLAGS = -j85i -d3
Xd27 6
Xa32 1
X#
Xa34 1
X# $(CC2) -. $(C2FLAGS) QUAD:$*.q
Xa36 3
X.c.o:
X $(CC1) -. $(C1FLAGS) $(CFLAGS) -oQUAD: $*
X $(CC3) -. $(C3FLAGS) -o$*.o QUAD:$*.q
Xa40 1
X#
Xd49 1
Xa49 6
X# 1. Figure out where to put the RCS commands; define RCSDIR accordingly.
X
XRCSDIR = RCS:
X
X
X# 2. Early version of diff did not support options needed by RCS.
Xd56 2
Xa57 2
XDIFF = ${RCSDIR}diff
XDIFF3 = ${RCSDIR}diff3
Xd59 1
Xa59 1
XED = ${RCSDIR}ked
Xd61 3
Xd95 2
Xa96 2
XLDFLAGS = quiet batch nodebug
XLDLIBS = LIB:rsbx.lib LIB:lc.lib LIB:amiga.lib
Xd110 1
Xa110 1
XDEFINES = $(OS) $(ARGS) -dSIGNAL_TYPE=$(SIGNAL_TYPE) -dSTRICT_LOCKING=$(LOCKING) -dDIFF="$(DIFF)" -dDIFF3="$(DIFF3)" -dED="$(ED)" -dCO="${RCSDIR}co" -dMERGE="${RCSDIR}merge"
Xd136 1
Xa136 1
XBCOMMANDS = ci co ident merge rcs rcsdiff rcsmerge rlog
Xa145 11
Xinstall:
X copy ci to RCS:
X copy co to RCS:
X copy ident to RCS:
X copy merge to RCS:
X copy rcs to RCS:
X copy rcsdiff to RCS:
X copy rcsmerge to RCS:
X copy rlog to RCS:
X
X
Xd147 3
Xa149 3
X -delete \#?.o
X -delete $(RCSCOMMANDS) snoop
X -delete \#?.tmp
Xd153 2
Xa154 1
Xci: $(CIOBJ) $(LDLIBS)
Xd156 1
Xa156 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(CIOBJ) LIB $(LDLIBS)
Xd161 2
Xa162 1
Xco: $(COOBJ) $(LDLIBS)
Xd164 1
Xa164 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(COOBJ) LIB $(LDLIBS)
Xd168 2
Xa169 1
Xident: $(IDENTOBJ) $(LDLIBS)
Xd171 1
Xa171 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(IDENTOBJ) LIB $(LDLIBS)
Xa174 7
XMERGEOBJ = merge.o
Xmerge: $(MERGEOBJ) $(LDLIBS)
X -delete $@@
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(MERGEOBJ) LIB $(LDLIBS)
X rename $@@.tmp $@@
X
X
Xd176 2
Xa177 1
Xrlog: $(RLOGOBJ) $(LDLIBS)
Xd179 1
Xa179 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(RLOGOBJ) LIB $(LDLIBS)
Xd184 2
Xa185 1
Xrcs: $(RCSOBJ) $(LDLIBS)
Xd187 1
Xa187 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(RCSOBJ) LIB $(LDLIBS)
Xd192 2
Xa193 1
Xrcsdiff: $(RCSDIFFOBJ) $(LDLIBS)
Xd195 1
Xa195 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(RCSDIFFOBJ) LIB $(LDLIBS)
Xd200 2
Xa201 1
Xrcsmerge: $(RCSMERGEOBJ) $(LDLIBS)
Xd203 1
Xa203 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(RCSMERGEOBJ) LIB $(LDLIBS)
Xd207 2
Xa208 1
Xsnoop: $(SNOOPOBJ) $(LDLIBS)
Xd210 1
Xa210 1
X ${LD} $(LDFLAGS) TO $@@.tmp FROM LIB:xc.o $(SNOOPOBJ) LIB $(LDLIBS)
Xd214 1
Xa214 1
XSOURCE= ci.c co.c curdir.c ident.c maketime.c merge.c partime.c rcs.c \
Xa245 1
Xmerge.o: merge.c
X@
X
X
X1.13.2.4
Xlog
X@Added new compile time switch LINK for RCS_link support.
X@
Xtext
X@d1 1
Xa1 1
X#$Header: /u/softeng/rsbx/rcs/amiga/RCS/Makefile,v 1.13.2.3 89/11/03 20:53:51 rsbx Exp Locker: rsbx $
Xa51 1
XRCSLINK = -dLINK
Xd53 1
Xd112 1
Xa112 1
XDEFINES = $(OS) $(ARGS) -dSIGNAL_TYPE=$(SIGNAL_TYPE) -dSTRICT_LOCKING=$(LOCKING) -dDIFF="$(DIFF)" -dDIFF3="$(DIFF3)" -dED="$(ED)" -dCO="${RCSDIR}co" -dMERGE="${RCSDIR}merge" $(RCSLINK)
X@
X
X
X1.13.1.1
Xlog
X@Start of cbmvax RCS source branch.
X@
Xtext
X@d1 1
Xa1 1
X#$Header: /u/softeng/rsbx/rcs/rcs.uunet/src/RCS/Makefile,v 1.13 89/05/02 14:53:40 narten Exp $
X@
X
X
X1.13.1.2
Xlog
X@Modified for cbmvax's environment and my testing.
X@
Xtext
X@d1 1
Xa1 1
X#$Header: /u/softeng/rsbx/rcs/rcs.uunet/src/RCS/Makefile,v 1.13.1.1 89/08/11 01:41:03 rsbx Exp Locker: rsbx $
Xd40 2
Xa41 2
XDIFF = /usr/local/bin/diff
XDIFF3 = /usr/local/bin/diff3
Xd45 1
Xa45 1
XRCSDIR = /u/softeng/rsbx/.bin
Xd50 1
Xa50 1
X#OLDDIR = /usr/old/bin
Xd66 1
Xa66 1
XSIGNAL_TYPE = void
Xd89 2
Xa90 2
X#SNOOPFILE = /usr/log/rcslog/log
X#SNOOP = /usr/local/bin/snoop
Xd92 1
Xa92 1
XDEFINES= $(OS) -DSIGNAL_TYPE=$(SIGNAL_TYPE) -DSTRICT_LOCKING=$(LOCKING) -DDIFF='"$(DIFF)"' -DCO='"${RCSDIR}/co"' -DMERGE='"${RCSDIR}/merge"'
Xd258 48
Xa305 22
Xci.c:
Xco.c:
Xcurdir.c:
Xident.c:
Xmaketime.c:
Xpartime.c:
Xrcs.c:
Xrcsclean.c:
Xrcsdiff.c:
Xrcsedit.c:
Xrcsfcmp.c:
Xrcsfnms.c:
Xrcsgen.c:
Xrcskeep.c:
Xrcskeys.c:
Xrcslex.c:
Xrcsmerge.c:
Xrcsrev.c:
Xrcssyn.c:
Xrcsutil.c:
Xrlog.c:
Xsnoop.c:
X@
SHAR_EOF
echo "extracting rcs/rcs.rcsfiles/co.c,v"
sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/co.c,v
Xhead 4.7;
Xbranch 4.7.2;
Xaccess ;
Xsymbols amiga_rcs:4.7.2 cbmvax_source:4.7.1 uunet_june89_dist:4.7;
Xlocks ; strict;
Xcomment @ * @;
X
X
X4.7
Xdate 89.05.01.15.11.41; author narten; state Exp;
Xbranches 4.7.1.1 4.7.2.1;
Xnext ;
X
X4.7.1.1
Xdate 89.08.11.01.41.39; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X4.7.2.1
Xdate 89.10.13.19.17.21; author rsbx; state Exp;
Xbranches ;
Xnext 4.7.2.2;
X
X4.7.2.2
Xdate 89.10.15.15.43.07; author rsbx; state Exp;
Xbranches ;
Xnext 4.7.2.3;
X
X4.7.2.3
Xdate 89.10.30.13.37.50; author rsbx; state Exp;
Xbranches ;
Xnext 4.7.2.4;
X
X4.7.2.4
Xdate 89.11.01.14.42.12; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X
Xdesc
X@RCS checkout operation.
X@
X
X
X
X4.7
Xlog
X@checked in with -k by rsbx at 89.08.10.16.01.05.
X@
Xtext
X@/* Copyright (C) 1982, 1988, 1989 Walter Tichy
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Walter Tichy.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X * Report all problems and direct all questions to:
X * rcs-bugs@@cs.purdue.edu
X *
X
X
X
X
X
X
X
X*/
X
X/*
X * RCS checkout operation
X */
X#ifndef lint
Xstatic char rcsid[]=
X"$Header: /usr/src/local/bin/rcs/src/RCS/co.c,v 4.7 89/05/01 15:11:41 narten Exp $ Purdue CS";
X#endif
X/*****************************************************************************
X * check out revisions from RCS files
X *****************************************************************************
X */
X
X
X/* $Log: co.c,v $
X * Revision 4.7 89/05/01 15:11:41 narten
X * changed copyright header to reflect current distribution rules
X *
X * Revision 4.6 88/11/08 12:02:31 narten
X * changes from eggert@@sm.unisys.com (Paul Eggert)
X *
X * Revision 4.6 88/08/09 19:12:15 eggert
X * Fix "co -d" core dump; rawdate wasn't always initialized.
X * Use execv(), not system(); fix putchar('\0') and diagnose() botches; remove lint
X *
X * Revision 4.5 87/12/18 11:35:40 narten
X * lint cleanups (from Guy Harris)
X *
X * Revision 4.4 87/10/18 10:20:53 narten
X * Updating version numbers changes relative to 1.1, are actually
X * relative to 4.2
X *
X * Revision 1.3 87/09/24 13:58:30 narten
X * Sources now pass through lint (if you ignore printf/sprintf/fprintf
X * warnings)
X *
X * Revision 1.2 87/03/27 14:21:38 jenkins
X * Port to suns
X *
X * Revision 1.1 84/01/23 14:49:58 kcs
X * Initial revision
X *
X * Revision 4.2 83/12/05 13:39:48 wft
X * made rewriteflag external.
X *
X * Revision 4.1 83/05/10 16:52:55 wft
X * Added option -u and -f.
X * Added handling of default branch.
X * Replaced getpwuid() with getcaller().
X * Removed calls to stat(); now done by pairfilenames().
X * Changed and renamed rmoldfile() to rmworkfile().
X * Replaced catchints() calls with restoreints(), unlink()--link() with rename();
X *
X * Revision 3.7 83/02/15 15:27:07 wft
X * Added call to fastcopy() to copy remainder of RCS file.
X *
X * Revision 3.6 83/01/15 14:37:50 wft
X * Added ignoring of interrupts while RCS file is renamed; this avoids
X * deletion of RCS files during the unlink/link window.
X *
X * Revision 3.5 82/12/08 21:40:11 wft
X * changed processing of -d to use DATEFORM; removed actual from
X * call to preparejoin; re-fixed printing of done at the end.
X *
X * Revision 3.4 82/12/04 18:40:00 wft
X * Replaced getdelta() with gettree(), SNOOPDIR with SNOOPFILE.
X * Fixed printing of "done".
X *
X * Revision 3.3 82/11/28 22:23:11 wft
X * Replaced getlogin() with getpwuid(), flcose() with ffclose(),
X * %02d with %.2d, mode generation for working file with WORKMODE.
X * Fixed nil printing. Fixed -j combined with -l and -p, and exit
X * for non-existing revisions in preparejoin().
X *
X * Revision 3.2 82/10/18 20:47:21 wft
X * Mode of working file is now maintained even for co -l, but write permission
X * is removed.
X * The working file inherits its mode from the RCS file, plus write permission
X * for the owner. The write permission is not given if locking is strict and
X * co does not lock.
X * An existing working file without write permission is deleted automatically.
X * Otherwise, co asks (empty answer: abort co).
X * Call to getfullRCSname() added, check for write error added, call
X * for getlogin() fixed.
X *
X * Revision 3.1 82/10/13 16:01:30 wft
X * fixed type of variables receiving from getc() (char -> int).
X * removed unused variables.
X */
X
X
X
X
X#include "rcsbase.h"
X#include "time.h"
X#include <sys/types.h>
X#include <sys/stat.h>
X
X#ifndef lint
Xstatic char rcsbaseid[] = RCSBASE;
X#endif
Xstatic char co[] = CO;
Xstatic char merge[] = MERGE;
X
Xextern FILE * fopen();
Xextern int rename();
Xextern char * getcaller(); /*get login of caller */
Xextern struct hshentry * genrevs(); /*generate delta numbers */
Xextern char * getancestor();
Xextern int nextc; /*next input character */
Xextern int nerror; /*counter for errors */
Xextern char Kdesc[]; /*keyword for description */
Xextern char * buildrevision(); /*constructs desired revision */
Xextern int buildjoin(); /*join several revisions */
Xextern char * mktempfile(); /*temporary file name generator */
Xextern struct hshentry * findlock();/*find (and delete) a lock */
Xextern struct lock * addlock(); /*add a new lock */
Xextern long maketime(); /*convert parsed time to unix time. */
Xextern struct tm * localtime(); /*convert unixtime into a tm-structure */
Xextern FILE * finptr; /* RCS input file */
Xextern FILE * frewrite; /* new RCS file */
Xextern int rewriteflag; /* indicates whether input should be */
X /* echoed to frewrite */
X
Xchar * newRCSfilename, * neworkfilename;
Xchar * RCSfilename, * workfilename;
Xextern struct stat RCSstat, workstat; /* file status of RCS and work file */
Xextern int haveRCSstat, haveworkstat;/* status indicators */
X
Xchar * date, * rev, * state, * author, * join;
Xchar finaldate[datelength];
X
Xint forceflag, lockflag, unlockflag, tostdout;
Xchar * caller; /* caller's login; */
Xextern quietflag;
X
Xchar numericrev[revlength]; /* holds expanded revision number */
Xstruct hshentry * gendeltas[hshsize]; /* stores deltas to be generated */
Xstruct hshentry * targetdelta; /* final delta to be generated */
X
Xchar * joinlist[joinlength]; /* pointers to revisions to be joined */
Xint lastjoin; /* index of last element in joinlist */
X
Xmain (argc, argv)
Xint argc;
Xchar * argv[];
X{
X int killock; /* indicates whether a lock is removed*/
X char * cmdusage;
X struct tm parseddate, *ftm;
X char * rawdate;
X long unixtime;
X
X catchints();
X cmdid = "co";
X cmdusage = "command format:\nco -f[rev] -l[rev] -p[rev] -q[rev] -r[rev] -ddate -sstate -w[login] -jjoinlist file ...";
X date = rev = state = author = join = nil;
X forceflag = lockflag = unlockflag = tostdout = quietflag = false;
X caller=getcaller();
X rawdate = "";
X
X while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
X switch ((*argv)[1]) {
X
X case 'r':
X revno: if ((*argv)[2]!='\0') {
X if (rev!=nil) warn("Redefinition of revision number");
X rev = (*argv)+2;
X }
X break;
X
X case 'f':
X forceflag=true;
X goto revno;
X
X case 'l':
X lockflag=true;
X if (unlockflag) {
X warn("-l has precedence over -u");
X unlockflag=false;
X }
X goto revno;
X
X case 'u':
X unlockflag=true;
X if (lockflag) {
X warn("-l has precedence over -u");
X unlockflag=false;
X }
X goto revno;
X
X case 'p':
X tostdout=true;
X goto revno;
X
X case 'q':
X quietflag=true;
X goto revno;
X
X case 'd':
X if ((*argv)[2]!='\0') {
X if (date!=nil) warn("Redefinition of -d option");
X rawdate=(*argv)+2;
X }
X /* process date/time */
X if (partime(rawdate,&parseddate)==0)
X faterror("Can't parse date/time: %s",rawdate);
X if ((unixtime=maketime(&parseddate))== 0L)
X faterror("Inconsistent date/time: %s",rawdate);
X ftm=localtime(&unixtime);
X VOID sprintf(finaldate,DATEFORM,
X ftm->tm_year,ftm->tm_mon+1,ftm->tm_mday,ftm->tm_hour,ftm->tm_min,ftm->tm_sec);
X date=finaldate;
X break;
X
X case 'j':
X if ((*argv)[2]!='\0'){
X if (join!=nil)warn("Redefinition of -j option");
X join = (*argv)+2;
X }
X break;
X
X case 's':
X if ((*argv)[2]!='\0'){
X if (state!=nil)warn("Redefinition of -s option");
X state = (*argv)+2;
X }
X break;
X
X case 'w':
X if (author!=nil)warn("Redefinition of -w option");
X if ((*argv)[2]!='\0')
X author = (*argv)+2;
X else author = caller;
X break;
X
X default:
X faterror("unknown option: %s\n%s", *argv,cmdusage);
X
X };
X } /* end of option processing */
X
X if (argc<1) faterror("No input file\n%s",cmdusage);
X
X /* now handle all filenames */
X do {
X rewriteflag=false;
X finptr=frewrite=NULL;
X neworkfilename=nil;
X
X if (!pairfilenames(argc,argv,true,tostdout)) continue;
X
X /* now RCSfilename contains the name of the RCS file, and finptr
X * the file descriptor. If tostdout is false, workfilename contains
X * the name of the working file, otherwise undefined (not nil!).
X * Also, RCSstat, workstat, and haveworkstat have been set.
X */
X diagnose("%s --> %s", RCSfilename,tostdout?"stdout":workfilename);
X
X
X if (!tostdout && !trydiraccess(workfilename)) continue; /* give up */
X if ((lockflag||unlockflag) && !checkaccesslist(caller)) continue; /* give up */
X if (!trysema(RCSfilename,lockflag||unlockflag)) continue; /* give up */
X
X
X gettree(); /* reads in the delta tree */
X
X if (Head==nil) {
X /* no revisions; create empty file */
X diagnose("no revisions present; generating empty revision 0.0");
X if (!tostdout)
X if (!creatempty()) continue;
X /* Can't reserve a delta, so don't call addlock */
X } else {
X if (rev!=nil) {
X /* expand symbolic revision number */
X if (!expandsym(rev,numericrev))
X continue;
X } elsif (unlockflag && (targetdelta=findlock(caller,false))!=nil) {
X VOID strcpy(numericrev,targetdelta->num);
X } elsif (Dbranch!=nil) {
X VOID strcpy(numericrev,Dbranch->num);
X } else numericrev[0]='\0'; /* empty */
X /* get numbers of deltas to be generated */
X if (!(targetdelta=genrevs(numericrev,date,author,state,gendeltas)))
X continue;
X /* check reservations */
X if (lockflag && !addlock(targetdelta,caller))
X continue;
X
X if (unlockflag) {
X if((killock=rmlock(caller,targetdelta))== -1)
X continue;
X } else {
X killock=0;
X }
X
X if (join && !preparejoin()) continue;
X
X diagnose("revision %s%s",targetdelta->num,
X lockflag?" (locked)":
X unlockflag?" (unlocked)":"");
X
X /* remove old working file if necessary */
X if (!tostdout)
X if (!rmworkfile()) continue;
X
X /* prepare for rewriting the RCS file */
X if (lockflag||(killock==1)) {
X newRCSfilename=mktempfile(RCSfilename,NEWRCSFILE);
X if ((frewrite=fopen(newRCSfilename, "w"))==NULL) {
X error("Can't open file %s",newRCSfilename);
X continue;
X }
X putadmin(frewrite);
X puttree(Head,frewrite);
X VOID fprintf(frewrite, "\n\n%s%c",Kdesc,nextc);
X rewriteflag=true;
X }
X
X /* skip description */
X getdesc(false); /* don't echo*/
X
X if (!(neworkfilename=buildrevision(gendeltas,targetdelta,
X tostdout?(join!=nil?"/tmp/":(char *)nil):workfilename,true)))
X continue;
X
X if ((lockflag||killock==1)&&nerror==0) {
X /* rewrite the rest of the RCSfile */
X fastcopy(finptr,frewrite);
X ffclose(frewrite); frewrite=NULL;
X ignoreints();
X if (rename(newRCSfilename,RCSfilename)<0) {
X error("Can't rewrite %s; saved in: %s",
X RCSfilename, newRCSfilename);
X newRCSfilename[0]='\0'; /* avoid deletion*/
X restoreints();
X break;
X }
X newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
X if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
X warn("Can't preserve mode of %s",RCSfilename);
X restoreints();
X }
X
X# ifdef SNOOPFILE
X logcommand("co",targetdelta,gendeltas,caller);
X# endif
X
X if (join) {
X rmsema(); /* kill semaphore file so other co's can proceed */
X if (!buildjoin(neworkfilename)) continue;
X }
X if (!tostdout) {
X if (rename(neworkfilename,workfilename) <0) {
X error("Can't create %s; see %s",workfilename,neworkfilename);
X neworkfilename[0]= '\0'; /*avoid deletion*/
X continue;
X }
X neworkfilename[0]= '\0'; /*avoid re-deletion by cleanup()*/
X }
X }
X if (!tostdout)
X if (chmod(workfilename, WORKMODE(RCSstat.st_mode))<0)
X warn("Can't adjust mode of %s",workfilename);
X
X
X if (!tostdout) diagnose("done");
X } while (cleanup(),
X ++argv, --argc >=1);
X
X exit(nerror!=0);
X
X} /* end of main (co) */
X
X
X/*****************************************************************
X * The following routines are auxiliary routines
X *****************************************************************/
X
Xint rmworkfile()
X/* Function: unlinks workfilename, if it exists, under the following conditions:
X * If it is read-only, workfilename is unlinked.
X * Otherwise (file writable):
X * if !quietmode asks the user whether to really delete it (default: fail);
X * otherwise failure.
X * Returns false on failure to unlink, true otherwise.
X */
X{
X int response, c; /* holds user response to queries */
X
X if (haveworkstat< 0) /* File doesn't exist; set by pairfilenames*/
X return (true); /* No problem */
X
X if ((workstat.st_mode & 0222)&&!forceflag) { /* File is writable */
X if (!quietflag) {
X VOID fprintf(stderr,"writable %s exists; overwrite? [ny](n): ",workfilename);
X /* must be stderr in case of IO redirect */
X c=response=getchar();
X while (!(c==EOF || c=='\n')) c=getchar(); /*skip rest*/
X if (!(response=='y'||response=='Y')) {
X warn("checkout aborted.");
X return false;
X }
X } else {
X error("writable %s exists; checkout aborted.",workfilename);
X return false;
X }
X }
X /* now unlink: either not writable, forceflag, or permission given */
X if (unlink(workfilename) != 0) { /* Remove failed */
X error("Can't unlink %s",workfilename);
X return false;
X }
X return true;
X}
X
X
Xcreatempty()
X/* Function: creates an empty working file.
X * First, removes an existing working file with rmworkfile().
X */
X{
X int fdesc; /* file descriptor */
X
X if (!rmworkfile()) return false;
X fdesc=creat(workfilename,0);
X if (fdesc < 0) {
X faterror("Cannot create %s",workfilename);
X return false;
X } else {
X VOID close(fdesc); /* empty file */
X return true;
X }
X}
X
X
Xint rmlock(who,delta)
Xchar * who; struct hshentry * delta;
X/* Function: removes the lock held by who on delta.
X * Returns -1 if someone else holds the lock,
X * 0 if there is no lock on delta,
X * and 1 if a lock was found and removed.
X */
X{ register struct lock * next, * trail;
X char * num;
X struct lock dummy;
X int whomatch, nummatch;
X
X num=delta->num;
X dummy.nextlock=next=Locks;
X trail = &dummy;
X while (next!=nil) {
X whomatch=strcmp(who,next->login);
X nummatch=strcmp(num,next->delta->num);
X if ((whomatch==0) && (nummatch==0)) break;
X /*found a lock on delta by who*/
X if ((whomatch!=0)&&(nummatch==0)) {
X error("revision %s locked by %s; use co -r or rcs -u",num,next->login);
X return -1;
X }
X trail=next;
X next=next->nextlock;
X }
X if (next!=nil) {
X /*found one; delete it */
X trail->nextlock=next->nextlock;
X Locks=dummy.nextlock;
X next->delta->lockedby=nil; /* reset locked-by */
X return 1; /*success*/
X } else return 0; /*no lock on delta*/
X}
X
X
X
X
X/*****************************************************************
X * The rest of the routines are for handling joins
X *****************************************************************/
X
Xchar * getrev(sp, tp, buffsize)
Xregister char * sp, *tp; int buffsize;
X/* Function: copies a symbolic revision number from sp to tp,
X * appends a '\0', and returns a pointer to the character following
X * the revision number; returns nil if the revision number is more than
X * buffsize characters long.
X * The revision number is terminated by space, tab, comma, colon,
X * semicolon, newline, or '\0'.
X * used for parsing the -j option.
X */
X{
X register char c;
X register int length;
X
X length = 0;
X while (((c= *sp)!=' ')&&(c!='\t')&&(c!='\n')&&(c!=':')&&(c!=',')
X &&(c!=';')&&(c!='\0')) {
X if (length>=buffsize) return false;
X *tp++= *sp++;
X length++;
X }
X *tp= '\0';
X return sp;
X}
X
X
X
Xint preparejoin()
X/* Function: Parses a join list pointed to by join and places pointers to the
X * revision numbers into joinlist.
X */
X{
X struct hshentry * * joindeltas;
X struct hshentry * tmpdelta;
X register char * j;
X char symbolrev[revlength],numrev[revlength];
X
X joindeltas = (struct hshentry * *)talloc(hshsize*sizeof(struct hshentry *));
X j=join;
X lastjoin= -1;
X for (;;) {
X while ((*j==' ')||(*j=='\t')||(*j==',')) j++;
X if (*j=='\0') break;
X if (lastjoin>=joinlength-2) {
X error("too many joins");
X return(false);
X }
X if(!(j=getrev(j,symbolrev,revlength))) return false;
X if (!expandsym(symbolrev,numrev)) return false;
X tmpdelta=genrevs(numrev,(char *)nil,(char *)nil,(char *)nil,(struct hshentry * *)joindeltas);
X if (tmpdelta==nil)
X return false;
X else joinlist[++lastjoin]=tmpdelta->num;
X while ((*j==' ') || (*j=='\t')) j++;
X if (*j == ':') {
X j++;
X while((*j==' ') || (*j=='\t')) j++;
X if (*j!='\0') {
X if(!(j=getrev(j,symbolrev,revlength))) return false;
X if (!expandsym(symbolrev,numrev)) return false;
X tmpdelta=genrevs(numrev,(char *)nil,(char *)nil,(char *)nil, (struct hshentry * *) joindeltas);
X if (tmpdelta==nil)
X return false;
X else joinlist[++lastjoin]=tmpdelta->num;
X } else {
X error("join pair incomplete");
X return false;
X }
X } else {
X if (lastjoin==0) { /* first pair */
X /* common ancestor missing */
X joinlist[1]=joinlist[0];
X lastjoin=1;
X /*derive common ancestor*/
X joinlist[0]=talloc(revlength);
X if (!getancestor(targetdelta->num,joinlist[1],joinlist[0]))
X return false;
X } else {
X error("join pair incomplete");
X return false;
X }
X }
X }
X if (lastjoin<1) {
X error("empty join");
X return false;
X } else return true;
X}
X
X
X
Xbuildjoin(initialfile)
Xchar * initialfile;
X/* Function: merge pairs of elements in joinlist into initialfile
X * If tostdout==true, copy result to stdout.
X * All unlinking of initialfile, rev2, and rev3 should be done by cleanup().
X */
X{
X char commarg[revlength+3];
X char subs[revlength];
X char * rev2, * rev3;
X int i;
X
X rev2=mktempfile("/tmp/",JOINFIL2);
X rev3=mktempfile("/tmp/",JOINFIL3);
X
X i=0;
X while (i<lastjoin) {
X /*prepare marker for merge*/
X if (i==0)
X VOID strcpy(subs,targetdelta->num);
X else VOID sprintf(subs, "merge%d",i/2);
X diagnose("revision %s",joinlist[i]);
X VOID sprintf(commarg,"-p%s",joinlist[i]);
X if (run((char*)nil,rev2, co,commarg,"-q",RCSfilename,(char*)nil)) {
X nerror++;return false;
X }
X diagnose("revision %s",joinlist[i+1]);
X VOID sprintf(commarg,"-p%s",joinlist[i+1]);
X if (run((char *)nil,rev3, co,commarg,"-q",RCSfilename,(char*)nil)) {
X nerror++; return false;
X }
X diagnose("merging...");
X if (
X (i+2)>=lastjoin && tostdout
X ? run((char*)nil,(char*)nil, merge,"-p",initialfile,rev2,rev3,subs,joinlist[i+1],(char*)nil)
X : run((char*)nil,(char*)nil, merge, initialfile,rev2,rev3,subs,joinlist[i+1],(char*)nil)) {
X nerror++; return false;
X }
X i=i+2;
X }
X return true;
X}
X@
X
X
X4.7.2.1
Xlog
X@Start of Amiga RCS port branch.
X@
Xtext
X@d31 1
Xa31 5
X<<<<<<< co.c
X"$Header: /u/softeng/rsbx/rcs/amiga/RCS.cbmvax/co.c,v 4.7.1.1 89/08/11 01:41:39 rsbx Exp Locker: rsbx $ Purdue CS";
X=======
X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/co.c,v 1.2 89/09/17 13:32:18 rick Exp $ Purdue CS";
X>>>>>>> 1.2
Xa39 11
X<<<<<<< co.c
X * Revision 4.7.1.1 89/08/11 01:41:39 rsbx
X * Start of cbmvax RCS source branch.
X=======
X * Revision 1.2 89/09/17 13:32:18 rick
X * Port to AmigaDos done by Rick Schaeffer (ricks@@iscuva.iscs.com)
X * All changes done with conditional compile (#ifdef AMIGA). This version
X * compiles correctly with Lattice C version 5.02 or later.
X>>>>>>> 1.2
X *
X<<<<<<< co.c
Xa40 3
X * checked in with -k by rsbx at 89.08.10.16.01.05.
X *
X * Revision 4.7 89/05/01 15:11:41 narten
Xa49 11
X=======
X * Revision 1.4 89/09/16 09:42:00 rick
X * Modified AMIGA changes to work with Lattice C
X *
X * Revision 1.3 89/09/10 09:26:21 rick
X * Moved TARGETDIR to rcs:
X *
X * Revision 1.2 88/09/03 15:06:55 rick
X * Port to AmigaDos. All done with conditional compiles
X *
X>>>>>>> 1.2
Xd119 1
Xa119 5
X#ifdef AMIGA
X#include "stat.h"
X#undef WORKMODE
X#define WORKMODE(RCSmode) (RCSmode | S_IWRITE)&~((lockflag||!StrictLocks)?S_IWRITE:0)
X#else
Xa121 2
X#endif
X#include "time.h"
Xa348 3
X#ifdef AMIGA
X tostdout?(join!=nil?"t\:":(char *)nil):workfilename,true)))
X#else
Xa349 1
X#endif
Xa356 4
X#ifdef AMIGA
X fclose(finptr);
X unlink(RCSfilename);
X#endif
Xa364 3
X#ifdef AMIGA
X if (chmod(RCSfilename,RCSstat.st_attr | S_IWRITE)<0)
X#else
Xa365 1
X#endif
Xa378 3
X#ifdef AMIGA
X unlink(workfilename);
X#endif
Xa387 3
X#ifdef AMIGA
X if (chmod(workfilename, WORKMODE(RCSstat.st_attr))<0)
X#else
Xa388 1
X#endif
Xd418 1
Xa418 3
X#ifdef AMIGA
X if (((workstat.st_attr & S_IWRITE) == 0)&&!forceflag) {
X#else
Xa419 1
X#endif
Xa422 3
X#ifdef AMIGA
X fflush(stderr);
X#endif
Xa607 4
X#ifdef AMIGA
X rev2=mktempfile("t:",JOINFIL2);
X rev3=mktempfile("t:",JOINFIL3);
X#else
Xa609 1
X#endif
Xa617 1
X<<<<<<< co.c
Xa619 4
X=======
X VOID sprintf(command,"%sco -p%s -q %s >%s\n",TARGETDIR,joinlist[i],RCSfilename,rev2);
X if (system(command)) {
X>>>>>>> 1.2
Xa622 1
X<<<<<<< co.c
Xa624 4
X=======
X VOID sprintf(command,"%sco -p%s -q %s >%s\n",TARGETDIR,joinlist[i+1],RCSfilename,rev3);
X if (system(command)) {
X>>>>>>> 1.2
X@
X
X
X4.7.2.2
Xlog
X@Finished the integration of Rick Schaeffer's RCS Amiga port with the RCS
Xsources I have here (and are later than the ones Rick used).
X@
Xtext
X@d31 5
Xa35 1
X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/co.c,v 4.7.2.1 89/10/13 19:17:21 rsbx Exp Locker: rsbx $ Purdue CS";
Xd44 1
Xa44 3
X * Revision 4.7.2.1 89/10/13 19:17:21 rsbx
X * Start of Amiga RCS port branch.
X *
Xd47 6
Xd54 1
Xd68 11
Xd683 1
Xd686 4
Xd693 1
Xd696 4
X@
X
X
X4.7.2.3
Xlog
X@NULL finptr after closing it.
X@
Xtext
X@d31 1
Xa31 1
X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/co.c,v 4.7.2.2 89/10/15 15:43:07 rsbx Exp $ Purdue CS";
Xa39 4
X * Revision 4.7.2.2 89/10/15 15:43:07 rsbx
X * Finished the integration of Rick Schaeffer's RCS Amiga port with the RCS
X * sources I have here (and are later than the ones Rick used).
X *
Xd377 1
Xa377 1
X fclose(finptr); finptr = NULL;
X@
X
X
X4.7.2.4
Xlog
X@Changes to make the delete bit to track the write bit. Made protection
Xbit manipulation less insane.
X@
Xtext
X@d31 1
Xa31 1
X"$Header: /u/softeng/rsbx/rcs/amiga/RCS/co.c,v 4.7.2.3 89/10/30 13:37:50 rsbx Exp $ Purdue CS";
Xa39 3
X * Revision 4.7.2.3 89/10/30 13:37:50 rsbx
X * NULL finptr after closing it.
X *
Xd134 2
Xd382 1
Xa382 5
X if (chmod(RCSfilename, RCSstat.st_attr|S_IDELETE)<0)
X warn("Can't adjust mode of %s",RCSfilename);
X if (unlink(RCSfilename) != 0) { /* Remove failed */
X error("Can't unlink %s",RCSfilename);
X }
Xd393 1
Xa393 1
X if (chmod(RCSfilename,RCSstat.st_attr & ~(S_IWRITE|S_IDELETE))<0)
Xa410 1
X chmod(workfilename, workstat.st_attr|S_IDELETE);
Xd423 1
Xa423 1
X if (chmod(workfilename, WORKMODE(RCSstat.st_attr))<0)
Xd425 1
Xa425 1
X if (chmod(workfilename, WORKMODE(RCSstat.st_mode))<0)
Xd427 1
Xa427 1
X warn("Can't adjust mode of %s",workfilename);
Xd457 1
Xa457 1
X if ((workstat.st_attr & S_IWRITE)&&!forceflag) {
Xa478 4
X#ifdef AMIGA
X if (chmod(workfilename, workstat.st_attr|S_IDELETE)<0)
X warn("Can't adjust mode of %s",workfilename);
X#endif
X@
X
X
X4.7.1.1
Xlog
X@Start of cbmvax RCS source branch.
X@
Xtext
X@d31 1
Xa31 1
X"$Header: /u/softeng/rsbx/rcs/rcs.uunet/src/RCS/co.c,v 4.7 89/05/01 15:11:41 narten Exp $ Purdue CS";
Xa39 3
X * Revision 4.7 89/05/01 15:11:41 narten
X * checked in with -k by rsbx at 89.08.10.16.01.05.
X *
X@
SHAR_EOF
echo "extracting rcs/rcs.rcsfiles/curdir.c,v"
sed 's/^X//' << \SHAR_EOF > rcs/rcs.rcsfiles/curdir.c,v
Xhead 3.3;
Xbranch 3.3.2;
Xaccess ;
Xsymbols amiga_rcs:3.3.2 cbmvax_source:3.3.1 uunet_june89_dist:3.3;
Xlocks ; strict;
Xcomment @ * @;
X
X
X3.3
Xdate 89.05.01.15.11.49; author narten; state Exp;
Xbranches 3.3.1.1 3.3.2.1;
Xnext ;
X
X3.3.1.1
Xdate 89.08.11.01.41.44; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X3.3.2.1
Xdate 89.10.13.19.17.29; author rsbx; state Exp;
Xbranches ;
Xnext 3.3.2.2;
X
X3.3.2.2
Xdate 89.10.15.15.43.16; author rsbx; state Exp;
Xbranches ;
Xnext ;
X
X
Xdesc
X@get current directory.
X@
X
X
X
X3.3
Xlog
X@checked in with -k by rsbx at 89.08.10.16.01.39.
X@
Xtext
X@/* Copyright (C) 1982, 1988, 1989 Walter Tichy
X * All rights reserved.
X *
X * Redistribution and use in source and binary forms are permitted
X * provided that the above copyright notice and this paragraph are
X * duplicated in all such forms and that any documentation,
X * advertising materials, and other materials related to such
X * distribution and use acknowledge that the software was developed
X * by Walter Tichy.
X * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
X * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
X * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
X *
X * Report all problems and direct all questions to:
X * rcs-bugs@@cs.purdue.edu
X *
X
X
X
X
X
X
X
X*/
X
X/*******************************************************************
X * curdir: get current directory
X *******************************************************************
X * returns full pathname of working (current) directory.
X * This is an adaptation of pwd, and works for grafted directories.
X * Unlike pwd, returns to current directory after it is finished.
X * Uses stdio buffering for directory reads.
X */
X
X static char rcsid[]=
X "$Header: /usr/src/local/bin/rcs/src/RCS/curdir.c,v 3.3 89/05/01 15:11:49 narten Exp $";
X
X/*******************************************************************
X * $Log: curdir.c,v $
X * Revision 3.3 89/05/01 15:11:49 narten
X * changed copyright header to reflect current distribution rules
X *
X * Revision 3.2 87/10/18 10:21:49 narten
X * Updating version numbers. Changes relative to 1.1 are actually
X * relative to 3.2
X *
X * Revision 1.1 84/01/23 14:50:01 kcs
X * Initial revision
X *
X * Revision 3.2 82/12/24 15:41:51 wft
X * Changed curdir() such that it returns a pointer to the pathname of
X * the current working directory, just as Berkeley's getcwd().
X *
X * Revision 3.1 82/10/18 21:16:21 wft
X * curdir() now uses stdio buffering for directory reads,
X * returns to working directory after done, and closes the directories.
X * A testprogram was also added.
X *
X *******************************************************************/
X
X
X#include "rcsbase.h"
X#include <sys/param.h>
X#include <sys/stat.h>
X#include <sys/dir.h>
X#define dot "."
X#define dotdot ".."
X
X
Xstatic char cwd[NCPPN];
X
Xchar * curdir()
X/* Function: places the pathname of the current directory into cwd
X * and returns a pointer to it. Returns NULL on failure.
X */
X{
X FILE *file;
X struct stat d, dd;
X struct direct dir;
X
X int rdev, rino;
X int off;
X register i,j;
X
X cwd[off= 0] = '/';
X cwd[1] = '\0';
X stat("/", &d);
X rdev = d.st_dev;
X rino = d.st_ino;
X for (;;) {
X if (stat(dot, &d)<0) return NULL;
X if (d.st_ino==rino && d.st_dev==rdev) {
X if (cwd[off] == '/') cwd[off] = '\0';
X chdir(cwd); /*change back to current directory*/
X return cwd;
X }
X if ((file = fopen(dotdot,"r")) == NULL) return NULL;
X if (fstat(fileno(file), &dd)<0) goto fail;
X chdir(dotdot);
X if(d.st_dev == dd.st_dev) {
X if(d.st_ino == dd.st_ino) {
X if (cwd[off] == '/') cwd[off] = '\0';
X chdir(cwd); /*change back to current directory*/
X fclose(file);
X return cwd;
X }
X do {
X if (fread((char *)&dir, sizeof(dir), 1, file) !=1)
X goto fail;
X } while (dir.d_ino != d.st_ino);
X }
X else do {
X if(fread((char *)&dir, sizeof(dir), 1, file) != 1) {
X goto fail;
X }
X stat(dir.d_name, &dd);
X } while(dd.st_ino != d.st_ino || dd.st_dev != d.st_dev);
X fclose(file);
X
X /* concatenate file name */
X i = -1;
X while (dir.d_name[++i] != 0);
X for(j=off+1; j>0; --j)
X cwd[j+i+1] = cwd[j];
X off=i+off+1;
X cwd[i+1] = '/';
X for(--i; i>=0; --i)
X cwd[i+1] = dir.d_name[i];
X } /* end for */
X
Xfail: fclose(file);
X return NULL;
X}
X
X
X#ifdef TEST
Xmain ()
X{
X printf ("pwd = %s\n", curdir());
X}
X#endif TEST
X
X@
X
X
X3.3.2.1
Xlog
X@Start of Amiga RCS port branch.
X@
Xtext
X@d36 1
Xa36 5
X<<<<<<< curdir.c
X "$Header: /u/softeng/rsbx/rcs/amiga/RCS.cbmvax/curdir.c,v 3.3.1.1 89/08/11 01:41:44 rsbx Exp Locker: rsbx $";
X=======
X "$Header: /u/softeng/rsbx/rcs/amiga/RCS/curdir.c,v 1.2 89/09/17 13:40:50 rick Exp $";
X>>>>>>> 1.2
Xa39 4
X<<<<<<< curdir.c
X * Revision 3.3.1.1 89/08/11 01:41:44 rsbx
X * Start of cbmvax RCS source branch.
X *
Xa40 3
X * checked in with -k by rsbx at 89.08.10.16.01.39.
X *
X * Revision 3.3 89/05/01 15:11:49 narten
Xa41 9
X=======
X * Revision 1.2 89/09/17 13:40:50 rick
X * Port to AmigaDos done by Rick Schaeffer (ricks@@iscuva.iscs.com)
X * All changes done with condition compile (#ifdef AMIGA). This
X * version compiles correctly with Lattice C version 5.02 or later.
X *
X * Revision 1.1 89/09/17 13:04:17 rick
X * Initial revision
X>>>>>>> 1.2
X@
X
X
X3.3.2.2
Xlog
X@Finished the integration of Rick Schaeffer's RCS Amiga port with the RCS
Xsources I have here (and are later than the ones Rick used).
X@
Xtext
X@d36 5
Xa40 1
X "$Header: /u/softeng/rsbx/rcs/amiga/RCS/curdir.c,v 3.3.2.1 89/10/13 19:17:29 rsbx Exp Locker: rsbx $";
Xd44 1
Xa44 3
X * Revision 3.3.2.1 89/10/13 19:17:29 rsbx
X * Start of Amiga RCS port branch.
X *
Xd53 9
X@
X
X
X3.3.1.1
Xlog
X@Start of cbmvax RCS source branch.
X@
Xtext
X@d36 1
Xa36 1
X "$Header: /u/softeng/rsbx/rcs/rcs.uunet/src/RCS/curdir.c,v 3.3 89/05/01 15:11:49 narten Exp $";
Xa39 3
X * Revision 3.3 89/05/01 15:11:49 narten
X * checked in with -k by rsbx at 89.08.10.16.01.39.
X *
X@
SHAR_EOF
echo "End of archive 13 (of 14)"
# if you want to concatenate archives, remove anything after this line
exit